﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajax_solution.aspx.cs" Inherits="MultyLanguage.ajax_solution" %>

<%
 
   

if (Request.Params["control"] != null && Request.Params["language"] != null && Request.Params["control"].Length > 0 && Request.Params["language"].Length > 0)
{
    string ctrl = Request.Params["control"];
    string lang = Request.Params["language"];
    //Response.Write(ctrl + ", " + lang);
    string page = Request.Params["page"];
    string[] parr = page.Split(new char[] { '\\' });
    string xmlpath = Server.MapPath("~/language/" + lang + "/" + parr[parr.Length - 1] + ".xml");
    if (System.IO.File.Exists(xmlpath) == true)
    {
        string carr = ctrl.Split(new char[] { '.' })[1];
           //save text of control
        if (carr.Contains("undefined"))
            Response.Write("Control id is not undefined");
        else
        {
            if (Request.Params["val"] != null && Request.Params["val"].Length > 0)
            {
                Response.Write(MultyLanguage.XMLUltility.SetOrEditValue("item", carr, System.Web.HttpUtility.HtmlEncode(Request.Params["val"]), xmlpath));

            }
            // get text of control    
            else
            {
                Response.Write(MultyLanguage.XMLUltility.getValueByID("item", carr, xmlpath));
            }
        }
    }
    else
    {
        Response.Write(" ");
    }

}
else
    Response.Write(" ");
%>